
/*
* Copyright 2017-2018 pinganfang
* All right reserved.
*
*/
package com.pingan.haofang.searchcloud.indexdatasource.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.pingan.haofang.searchcloud.common.domain.BaseDomain;
import com.pingan.haofang.searchcloud.common.domain.IdGetter;

/**
 * 索引全量增量rpc构建注册信息
 *
 * @author huhailiang937
 */
@Entity
@Table(name = "t_index_datasource_rpc")
@EntityListeners({AuditingEntityListener.class})
public class IndexDatasourceRpc extends BaseDomain implements IdGetter<Long> {

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;

    /**
     * 导入URL
     */
    @Column(name = "rpc_url")
    private String rpcUrl;

    /**
     * 导入RPC方法
     */
    @Column(name = "rpc_method")
    private String rpcMethod;

    /**
     * 启用字段
     */
    @Column(name = "index_Field")
    private String indexField;

    /**
     * 批次查询分页大小
     */
    @Column(name = "import_pagesize")
    private Integer importPageize;

    /**
     * 全量导入起始页
     */
    @Column(name = "import_startpage")
    private Integer importStartPage;

    /**
     * cron表达式
     */
    @Column(name = "import_cron")
    private String importCron;

    /**
     * 缓冲状态 0：正常  1：停用
     */
    @Column(name = "buffer_status")
    private Integer bufferStatus;

    /**
     * 最大缓冲容量
     */
    @Column(name = "buffer_size")
    private Integer bufferSize;

    /**
     * 最大等待时间，毫秒
     */
    @Column(name = "max_wait_time")
    private Integer maxWaitTime;

    /**
     * 状态 0：正常 1：停用
     */
    @Column(name = "status")
    protected Integer status;

    /**
     * 线程数量，大于1时开启多线程
     */
    @Column(name = "thread_num")
    private Integer threadNum;

    /**
     * 是否查询优化，1是，0否
     */
    @Column(name = "query_optimize")
    private Integer queryOptimize;

    @Override
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getRpcUrl() {
        return rpcUrl;
    }

    public void setRpcUrl(String rpcUrl) {
        this.rpcUrl = rpcUrl;
    }

    public String getRpcMethod() {
        return rpcMethod;
    }

    public void setRpcMethod(String rpcMethod) {
        this.rpcMethod = rpcMethod;
    }

    public String getIndexField() {
        return indexField;
    }

    public void setIndexField(String indexField) {
        this.indexField = indexField;
    }

    public Integer getImportPageize() {
        return importPageize;
    }

    public void setImportPageize(Integer importPageize) {
        this.importPageize = importPageize;
    }

    public Integer getImportStartPage() {
        return importStartPage;
    }

    public void setImportStartPage(Integer importStartPage) {
        this.importStartPage = importStartPage;
    }

    public String getImportCron() {
        return importCron;
    }

    public void setImportCron(String importCron) {
        this.importCron = importCron;
    }

    public Integer getBufferStatus() {
        return bufferStatus;
    }

    public Integer getBufferSize() {
        return bufferSize;
    }

    public Integer getMaxWaitTime() {
        return maxWaitTime;
    }

    public void setBufferStatus(Integer bufferStatus) {
        this.bufferStatus = bufferStatus;
    }

    public void setBufferSize(Integer bufferSize) {
        this.bufferSize = bufferSize;
    }

    public void setMaxWaitTime(Integer maxWaitTime) {
        this.maxWaitTime = maxWaitTime;
    }

    /**
     * @return the status
     */
    public Integer getStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getThreadNum() {
        return threadNum;
    }

    public void setThreadNum(Integer threadNum) {
        this.threadNum = threadNum;
    }

    public Integer getQueryOptimize() {
        return queryOptimize;
    }

    public void setQueryOptimize(Integer queryOptimize) {
        this.queryOptimize = queryOptimize;
    }

    @Override
    public String toString() {
        return "IndexDatasourceRpc{" +
                "id=" + id +
                ", rpcUrl='" + rpcUrl + '\'' +
                ", rpcMethod='" + rpcMethod + '\'' +
                ", importPageize=" + importPageize +
                ", importStartPage=" + importStartPage +
                ", importCron='" + importCron + '\'' +
                ", bufferStatus=" + bufferStatus +
                ", bufferSize=" + bufferSize +
                ", maxWaitTime=" + maxWaitTime +
                ", status=" + status +
                ", threadNum=" + threadNum +
                ", queryOptimize=" + queryOptimize +
                '}';
    }
}
